package edu.westga.sketchit2009cs.players;

/**
 * Player class used when creating players for the game.
 * @author RJ Hill
 *
 */
public class Player {
	
	private String playerName;
	private String oldPlayerName;
	private String IPAddress;
	private int playerScore;
	private boolean isDrawing;
	
	public Player() {
		
	}
	
	/**
	 * Sets the player's name to the input value and sets
	 * everything else to default null values.
	 * Requires: playerName != null
	 * <p>
	 * Ensures: this.playerName == getName()
	 * <p>
	 * @param playerName the name the player logs in with
	 */
	public Player(String playerName) {
		this.playerName = playerName;
		this.oldPlayerName = playerName;
		this.IPAddress = "";
		this.playerScore = 0;
		this.isDrawing = false;
	}
	
	/**
	 * Sets the player's name to the input value and sets
	 * everything else to default null values.
	 * Requires: playerName != null && IPAddress != null
	 *           && playerScore != null && isDrawing != null
	 * <p>
	 * Ensures: this.playerName == getName()
	 * 			this.IPAddress == getIP()
	 * 			this.playerScore == getScore()
	 * 			this.isDrawing == getDrawingPriveleges()
	 * <p>
	 * @param playerName the name the player logs in with
	 * @param IPAddress the ip address the player logs in with
	 * @param playerScore the players initial score
	 * @param isDrawing the players drawing privileges
	 */
	public Player(String playerName, String IPAddress, int playerScore, boolean isDrawing) {
		this.playerName = playerName;
		this.oldPlayerName = playerName;
		this.IPAddress = IPAddress;
		this.playerScore = playerScore;
		this.isDrawing = isDrawing;
	}
	
	// playerName getter and setter
	
	/**
	 * Returns the name of the specified player.
	 * @return the name of the player
	 */
	public String getName() {
		return this.playerName;
	}
	
	/**
	 * Returns the original name of the specified player.
	 * @return the original name of the player
	 */
	public String getOldName() {
		return this.oldPlayerName;
	}
	
	/**
	 * Sets the name of the specified player.
	 * @param newName the new name of the player
	 */
	public void setName(String newName) {
		this.playerName = newName;
	}
	
	// IPAddress getter and setter
	
	/**
	 * Returns the ip address of the specified player.
	 * @return the ip address of the player
	 */
	public String getIP() {
		return this.IPAddress;
	}
	
	// playerScore getter and setter
	
	/**
	 * Returns the score of the specified player.
	 * @return the score of the player
	 */
	public int getScore() {
		return this.playerScore;
	}
	
	/**
	 * Sets the players score to a specified number.
	 * @param newScore a new score to give to the player
	 */
	public void setScore(int newScore) {
		this.playerScore = newScore;
	}
	
	/**
	 * Adds a specific amount to the players score.
	 * @param increment number to increment the score by
	 */
	public void incrementScore(int increment) {
		this.playerScore += increment;
	}
	
	// isDrawing getter and setter
	
	/**
	 * Returns the drawing privileges of the specified player
	 * @return the drawing privileges of the player
	 */
	public boolean getDrawingPriveleges() {
		return this.isDrawing;
	}
	
	/**
	 * Sets the players drawing privileges to a specified boolean value
	 * @param isDrawing
	 */
	public void setDrawingPriveleges(boolean isDrawing) {
		this.isDrawing = isDrawing;
	}
	
}
